package com.jiyun.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jiyun.mapper.ThContractMapper;
import com.jiyun.pojo.ThContract;
import com.jiyun.service.IThContractService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import common.models.dtos.ContractDto;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author usian
 * @since 2022-10-24
 */
@Service
public class ThContractServiceImpl extends ServiceImpl<ThContractMapper, ThContract> implements IThContractService {

    @Override
    public List<ThContract> findKeyList(ContractDto dto) {

        String key = dto.getKey();
        LambdaQueryWrapper<ThContract> queryWrapper=new LambdaQueryWrapper<>();
        if (!StringUtils.isEmpty(key)){
            queryWrapper.like(ThContract::getKeyword,key);
        }
        List<ThContract> list = this.list(queryWrapper);
        return list;
    }
}
